package org.example.controller;

import org.example.exception.BuinessException;
import org.example.po.ShoppingUser;
import org.example.rvo.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @GetMapping("/test")
    public ResultVO test(){

        ShoppingUser shoppingUser = new ShoppingUser();
        shoppingUser.setId("sdedewfdew");
        shoppingUser.setUserName("ddfewfref");
        return new ResultVO("200","success",shoppingUser);
    }

    @GetMapping("/demo01")
    public String demo01(@RequestParam("num") int num) throws BuinessException {
        if(num >= 10){
            throw  new BuinessException("num不能大于10");
        }
            return "ok";
    }
}
